#!/usr/bin/python3

# Copyright (C) 2015
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License (version 3+) as
# published by the Free Software Foundation. You should have received
# a copy of the GNU General Public License along with this program.
# If not, see <http://www.gnu.org/licenses/>.

from gi import require_version
require_version("Gtk", "3.0")
require_version("Notify", "0.7")
from gi.repository import Notify, Gtk, GLib

message = "Applying..."


def dialog_destroy(widget):
    widget.destroy()
    return True


class NotificationDialog:
    def __init__(self):
        win = Gtk.Window(type=Gtk.WindowType.TOPLEVEL)
        dialog = Gtk.MessageDialog(win, None, Gtk.MessageType.INFO,
                                   Gtk.ButtonsType.NONE, message)
        label = Gtk.Entry()
        dialog.set_focus(label)
        GLib.timeout_add(3000, dialog_destroy, dialog)
        dialog.run()
        dialog.destroy()


if __name__ == "__main__":
    try:
        Notify.init("numix-folders")
        n = Notify.Notification.new("Numix-folders", message, "gtk-info")
        n.show()
    except:
        dialog = NotificationDialog()
